From 028a15d99246ddf1ac126586a5680faab59e6a86 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 25 Oct 2022 20:27:00 +0100
Subject: [PATCH] overlays: Add i2c-sensor support for AHT10

Add support for the Aosong AHT10 temperature and humidity sensor.

See: https://github.com/raspberrypi/linux/issues/5222

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README                 |  3 +++
 arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi | 15 +++++++++++++++
 2 files changed, 18 insertions(+)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1933,6 +1933,9 @@ Params: addr                    Set the
                                 BMP280, CCS811, DS1621, HDC100X, LM75, SHT3x or
                                 TMP102
 
+        aht10                   Select the Aosong AHT10 temperature and humidity
+                                sensor
+
         bh1750                  Select the Rohm BH1750 ambient light sensor
                                 Valid addresses 0x23 or 0x5c, default 0x23
 
--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
@@ -309,6 +309,20 @@
 		};
 	};
 
+	fragment@20 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			aht10: aht10@38 {
+				compatible = "aosong,aht10";
+				reg = <0x38>;
+			};
+		};
+	};
+
 	__overrides__ {
 		bme280 = <0>,"+0";
 		bmp085 = <0>,"+1";
@@ -331,6 +345,7 @@
 		ccs811 = <0>, "+17";
 		bh1750 = <0>, "+18";
 		max30102 = <0>,"+19";
+		aht10 = <0>,"+20";
 
 		addr =  <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
 			<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
